package com.eshore.eurekamq;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
public class Sender {
    @Autowired
    private AmqpTemplate rabbitTemplate;
    public void send() {
        for (int i = 0; i < 10; i++) {
            String msg = "###############################hello rabbitmq:"+new Date();
            System.out.println("Sender:"+msg);
            this.rabbitTemplate.convertAndSend("testhello", msg);
        }

    }
}
